<?php
/**
 * Created by XM·Tan.
 * Motto: Who shuts love out, in turn shall be shut out from love.
 * Date: 2021/3/25 0:20
 */

namespace app\common\model\mysql;


class AdminAuth extends BaseModel {

    /**
     * title 查询提条件表达式
     * @param $query
     * @param $value
     */
    public function searchTitleAttr($query, $value) {
        $query->where('title', 'like', '%' . $value . '%');
    }


    /**
     * 首页 菜单 - 根据权限 rules 获取数据
     * @param array $data
     * @param $rules
     * @return \think\Collection
     * @throws \think\db\exception\DataNotFoundException
     * @throws \think\db\exception\DbException
     * @throws \think\db\exception\ModelNotFoundException
     */
    public function getNormalMenuListsAll($data = [], $rules) {
        $where = [];
        if (!empty($data)){
            $where = $data;
        }
        return $this->whereIn('status', [0, 1])->whereIn('id', $rules)->where($where)->select();
    }


}